package com.xs.springagain2.service;

import com.xs.springagain2.Dao.UserDao;
import com.xs.springagain2.config.DataSourceConfig;
import com.xs.springagain2.pojo.User;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.SQLException;

@Service
public class UserService {
    @Autowired
    private UserDao userDao;

    @Transactional
    public int addLibrary() {
//        UserDao userDao = (UserDao) ioc.getBean("userDao");
        int i = userDao.insertUser();
        int a = 1/0;
        return i;
    }
}
